<?php
   class Ajax extends MY_Controller{
	   public function __construct(){
		   parent::__construct();
		   $this->load->helper("url");
		   $this->load->model("model_ajax");
		   $this->load->model("model_index");
		   $this->load->model("model_search");
		   $this->load->library("pager");
	   }
	   public function short(){
		   $id   = $this->input->post("value");
		   $data = $this->model_index->getpackage($id);
		   if($data == NULL){
			   echo "<div style='padding:10px;height:200px'>No result</div>";
		   }else{
			  //$this->debug($data);
			  foreach($data as $items){
				  echo "<div class='box_bestselling2'>";
				  	echo "<div class='txt_box_bestselling'>";
						echo "<div class='img_box_bestselling'>";
							echo "<img src='".base_url()."uploads/tours/thumb/".$items['tour_image1']."' alt='' title='' width='160' height='102' />";
						echo "</div>";
						echo "<div class='tourname_bestselling'><a href='".base_url()."vietnam-package-tours-124/".$items['tour_name_rewrite']."-".$items['tour_id'].".html'><b>".$items['tour_name']."</b></a></div>";
						echo "<div class='date_bestselling'>3days - 2nights</div>";
						echo "<div class='price_old_bestselling'>Price: US $".$items['tour_price_old']."</div>";
						echo "<div class='price_new_bestselling'><b>NOW: US $".$items['tour_price']."</b></div>";
						echo "<div class='promotion_bestselling'>";
							echo "<ul>
				                      <li>Hot Deal 25% OFF</li>
				                      <li>Free gif member card</li>
				                      <li>Last Minute Booking</li>
				                 </ul>
						          ";
						echo "</div>";
						echo "<div class='detail_bestselling'><a href='".base_url()."vietnam-package-tours-124/".$items['tour_name_rewrite']."-".$items['tour_id'].".html' class='linktrang'>Click here for details</a></div>";
					echo "</div>";
				  echo "</div>";
			  }
		   }
	   }
	   public function request(){
		   if(!$_POST){ die();}
		   $name = $this->input->post("name");
		   $email = $this->input->post("email");
		   $address = $this->input->post("add");
		   $adult = $this->input->post("adult");
		   $child = $this->input->post("child");
		   $type = $this->input->post("type");
		   $date = $this->input->post("date");
		   $country = $this->input->post("country");
		   $days = $this->input->post("days");
		   $phone = $this->input->post("phone");
		   $info = $this->input->post("info");
		   $title = $this->input->post("title");
		   $db = array(
		   		"request_title" => $title,
		   		"request_name" => $this->fillter($name),
				"request_email" => $this->fillter($email),
				"request_add" => $this->fillter($address),
				"request_adult" => $this->fillter($adult),
				"request_child" => $this->fillter($child),
				"request_type" => $this->fillter($type),
				"request_country" => $this->fillter($country),
				"request_startdate" => $this->fillter($date),
				"request_days" => $this->fillter($days),
				"request_phone" => $this->fillter($phone),
				"request_info" => $this->fillter($info),
				"request_date" => date("m/d/Y H:i:s")
		   );
		   $this->model_index->add_request($db);
		   echo "<span style='color:#060;font-weight:bold'>Thanks for your request, We will contact with you soon!</span>";
	   }
   }

